from django.urls import path, include, re_path
from rest_framework.routers import DefaultRouter, SimpleRouter

from app import views, views_admin

router = SimpleRouter()
router.register(r"course", views.CourseApi)
router.register(r"courseVideo", views.CourseVideoApi)
router.register(r"courseType", views.CourseTypeApi)
router.register(r"studyRecord", views.StudyRecordApi)
router.register(r"admin/user", views_admin.UserApi)
router.register(r"admin/courseType", views_admin.CourseTypeApi)

urlpatterns = [
    path('user/<action>/', views.UserApi.as_view(
        {
            'post': 'post',
            'get': 'query_user',
            'put': 'update_user'
        }
    ), name='user'),
    path('userCheck/<username>', views.UserApi.as_view({'get': 'user_checking'}), name='user_check'),
    path('changeUser/password/', views.UserApi.as_view({'put': 'change_password'}), name='user_password_change'),
    re_path(r"^", include(router.urls)),
    # path('courseVideo/', views.CourseVideoApi.as_view(), name='course_video'),
]
